package com.spring.common.manageException.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Repository;

import com.spring.common.manageException.dao.ExceptionDao;
import com.spring.common.manageException.pojo.ExceptionInfo;



@Repository
public class ExceptionDaoImpl extends SqlMapClientDaoSupport implements ExceptionDao{

	@Override
	public ExceptionInfo getExceptionById(String id) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<ExceptionInfo> getExceptions(HashMap<String,String> map) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void recordException(ExceptionInfo exp) {
		// TODO Auto-generated method stub
		this.getSqlMapClientTemplate().insert("recordException",exp);
	}

	@Override
	public void updateException(ExceptionInfo exp) {
		// TODO Auto-generated method stub
		
	}
	@Override	
	public List<ExceptionInfo> getExceptionsAll(){
		return this.getSqlMapClientTemplate().queryForList("getExceptionAll",null);
	}
	@Override	
	public List<ExceptionInfo> getExceptionByExp(Map<String, Object> parameter){
		return this.getSqlMapClientTemplate().queryForList("getExceptionByExp",parameter);
	}
	@Override	
	public int getExceptionCount(Map<String, Object> parameter){
		return Integer.parseInt(this.getSqlMapClientTemplate().queryForList("getExceptionCount",parameter).toString().replace("[", "").replace("]", ""));
	}
	@Override
	public void updateExceptionStatus(String id){
		this.getSqlMapClientTemplate().update("updateExceptionStatus",id);
	}
}
